package com.itheima.pojo;

import lombok.Data;

@Data
public class Result {
    private int code; //1 code表示成功，0 code表示失败
    private String message;
    private Object data;


    public static Result success() {
        Result result = new Result();
        result.setCode(200);
        result.setMessage("success");
        result.setData(null);
        return result;
    }

    public static Result success(Object data) {
        Result result = new Result();
        result.setCode(200);
        result.setMessage("success");
        result.setData(data);
        return result;
    }

    public static Result error(String message) {
        Result result = new Result();
        result.setCode(500);
        result.setMessage(message);
        result.setData(null);
        return result;
    }

}
